package org.apache.flink.runtime.resourceconsumer;

import java.util.Map;

import org.apache.flink.runtime.allocatedeploy.execution.ExecutionID;
import org.apache.flink.runtime.clusterframework.types.ResourceID;
import org.apache.flink.runtime.resourceprovider.ResourceConsumptionReport;

/** Component for reconciling the deployment state of executions. */
public interface ExecutionDeploymentReconciler {

    /** Factory for {@link ExecutionDeploymentReconciler}. */
    interface Factory {
        ExecutionDeploymentReconciler create(
                ExecutionDeploymentReconciliationHandler reconciliationHandler);
    }

    /**
     * Reconciles the deployment states between all reported/expected executions for the given task
     * executor.
     *
     * @param taskExecutorHost hosting task executor
     * @param executionDeploymentReport task executor report for deployed executions
     * @param expectedDeployedExecutionIds map of expected executions and their current deployment
     *     status
     */
    void reconcileExecutionDeployments(
            ResourceID taskExecutorHost,
            ResourceConsumptionReport executionDeploymentReport,
            Map<ExecutionID, ExecutionDeploymentState> expectedDeployedExecutionIds);
}
